package singleton;

/**
 * TODO 简单说明
 *
 * @author yangyang
 * @date 2017/8/25 19:01
 * @email kekecany@163.com
 */
public class StaticInnerClassSingleton {

    private StaticInnerClassSingleton() {}

    /**
     * 只有在被调用的时候才会被装载，从而实现延迟加载
     */
    private static class SingletonHolder {
        /**
         * 静态初始化器，由JVM保证线程安全
         */
        private static StaticInnerClassSingleton singleton = new StaticInnerClassSingleton();
    }

    public static StaticInnerClassSingleton getInstance() {
        return SingletonHolder.singleton;
    }


}
